/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chatroom.com.entity;
/**
 *
 * @author Administrator
 */
import java.io.Serializable;
import java.util.Date;

public class MessageModel implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;
	private String fromWho;// 谁说的
	private String toWho;// 对谁说
	private String dongzuo;// 动作是什么
	private int biaoqing;// 表情是什么
	private String ziti;// 字体
	private String yanse;// 颜色
	private String daxiao;// 大小
	private String yangshi;// 样式

	private String content;// 内容
	private int isSiliao;// 是否私聊
	private Date sendTime;

	public static MessageModel getMsgByString(String str) {
		String rs[] = str.split("&");
		MessageModel msg = new MessageModel();
		msg.setFromWho(rs[1]);
		msg.setToWho(rs[2]);
		msg.setDongzuo(rs[3]);
		msg.setBiaoqing(Integer.parseInt(rs[4]));
		msg.setZiti(rs[5]);
		msg.setYanse(rs[6]);
		msg.setDaxiao(rs[7]);
		msg.setYangshi(rs[8]);
		msg.setContent(rs[9]);
		msg.setIsSiliao(Integer.parseInt(rs[10]));
		return msg;

	}

	public static String getStringByMessage(MessageModel msg) {
		return msg.getFromWho() + "&" + msg.getToWho() + "&" + msg.getDongzuo()
				+ "&" + msg.getBiaoqing() + "&" + msg.getZiti() + "&"
				+ msg.getYanse() + "&" + msg.getDaxiao() + "&"
				+ msg.getYangshi() + "&" + msg.getContent() + "&"
				+ msg.getIsSiliao();
	}

	@Override
	public String toString() {
		return "MessageModel [id=" + id + ", fromWho=" + fromWho + ", toWho="
				+ toWho + ", dongzuo=" + dongzuo + ", biaoqing=" + biaoqing
				+ ", ziti=" + ziti + ", yanse=" + yanse + ", daxiao=" + daxiao
				+ ", yangshi=" + yangshi + ", content=" + content
				+ ", isSiliao=" + isSiliao + ", sendTime=" + sendTime + "]";
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getFromWho() {
		return fromWho;
	}

	public void setFromWho(String fromWho) {
		this.fromWho = fromWho;
	}

	public String getToWho() {
		return toWho;
	}

	public void setToWho(String toWho) {
		this.toWho = toWho;
	}

	public String getDongzuo() {
		return dongzuo;
	}

	public void setDongzuo(String dongzuo) {
		this.dongzuo = dongzuo;
	}

	public int getBiaoqing() {
		return biaoqing;
	}

	public void setBiaoqing(int biaoqing) {
		this.biaoqing = biaoqing;
	}

	public String getZiti() {
		return ziti;
	}

	public void setZiti(String ziti) {
		this.ziti = ziti;
	}

	public String getYanse() {
		return yanse;
	}

	public void setYanse(String yanse) {
		this.yanse = yanse;
	}

	public String getDaxiao() {
		return daxiao;
	}

	public void setDaxiao(String daxiao) {
		this.daxiao = daxiao;
	}

	public String getYangshi() {
		return yangshi;
	}

	public void setYangshi(String yangshi) {
		this.yangshi = yangshi;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public int getIsSiliao() {
		return isSiliao;
	}

	public void setIsSiliao(int isSiliao) {
		this.isSiliao = isSiliao;
	}

	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

}

